home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-16 | 3.0 KB | 180 lines | [TEXT/KAHL] |
- /*****
- * FirstWindow_v00.c
- *
- * Routines per la gestione della prima finestra di StandAlone.
- *
- * 11/11/94 Prima stesura (Francesco Cadili)
- *
- ****/
-
-
- /***** Include standard *****/
- #ifndef _H_Film
- #include "Film.h"
- #endif
- #include "FirstWindow_v00.h"
- #include "Error.h"
- #include "LeggiFilm_v04.h"
- #include "StrUtilities.h"
-
- /***** Define macro *****/
-
- /***** Define valori *****/
-
- #pragma segment FirstWindow
-
- /***** Typedef globali *****/
-
- /***** Funzioni esterne *****/
-
- /***** Variabili esterne *****/
-
- /***** Variabili globali *****/
-
- DialogPtr FirstWnd;
- extern WindowPtr frontmost;
- Boolean NuovoRecord;
-
- /***** Statiche globali *****/
-
- /***** Function prototyping *****/
- static void ReleaseFirstWindowData(void);
-
- /****
- * FirstWindow(theWPtr, event)
- *
- * Gestisce la finestra di inserimento dello stile.
- *
- ****/
-
- void FirstWindow(void)
- {
- EventRecord event;
-
- // case WOPEN:
-
- #ifdef CONTROLLORISORSE
- CaricaRisorsa('DLOG', FirstDLOG);
- #endif
- frontmost = GetNewDialog(FirstDLOG, NULL, (WindowPtr)-1L);
- if (frontmost == NULL)
- {
- SetErrorData(kErrRisorse, 0, "getnewdialog", "durante la lettura di una risorsa", "Errore in memoria");
- ReleaseFirstWindowData();
- return;
- }
-
- SetWRefCon(frontmost, 0L); // devo settare il valore in qualche modo
- FirstWnd = frontmost;
- if (! Alloca_LeggiFilm(frontmost))
- {
- ReleaseFirstWindowData();
- return;
- }
-
- ShowWindow(frontmost);
- // SelectWindow(frontmost);
-
- /* inizio Loop */
-
- do {
- GetNextEvent (everyEvent, &event);
- }
- while(FirstWindow_Loop(FirstWnd, &event));
-
- /* fine loop */
-
- // case WCLOSE:
- ReleaseFirstWindowData();
- if(frontmost)
- DisposeDialog(frontmost);
- frontmost = nil;
- }
- /* end FirstWindow */
-
- /****
- * ReleaseFirstWindowData(void)
- *
- * Effettua tutte le operazioni di rilascio relative alla prima finestra.
- *
- ****/
-
- static void ReleaseFirstWindowData(void)
- {
- Dealloca_LeggiFilm();
- DisplayErrorData();
- ResetErrorData();
- }
- /* end ReleaseFirstWindowData */
-
- /****
- * FirstWindow_Loop(theWPtr, event)
- *
- * Gestisce la finestra di inserimento dello stile.
- *
- ****/
-
- short FirstWindow_Loop(WindowPtr theWPtr, EventRecord *myEvent)
- {
- short item, result;
-
- result = true;
- if(theWPtr)
- {
- SetPort(theWPtr);
- GlobalToLocal(&myEvent->where);
- }
-
- FirstWindowCursor(theWPtr, myEvent->where);
- FirstWindowIdle(theWPtr);
-
- switch(myEvent->what)
- {
- case updateEvt:
- LeggiFilm_updateEvt();
- break;
-
- case mouseDown:
- LocalToGlobal(&myEvent->where);
- /* prosegue */
-
- case keyDown:
- case autoKey:
- item = FirstWindowKeyDown(theWPtr, myEvent);
- switch(item)
- {
- case ok:
- NuovoRecord = false;
- break;
-
- case cancel:
- result = false;
- break;
-
- case w1tipoPopUpItem:
- //clickInPopUp(theWPtr, true);
- break;
-
- case w1tokenItem:
- ClickInTokenItem(myEvent);
- break;
-
- case w1ricerca:
- if(! ClickInRicerca())
- {
- DisplayErrorData();
- ResetErrorData();
- }
- break;
-
- case w1nuovo:
- NuovoRecord = true;
- break;
- }
- break;
- }
-
- return(result);
- }
- /* end FirstWindow_Loop */
-